# name : Retrieve file attribute (File Size, Create Time, etc.)
# key : file.attribute
# contributor: Shuguang Sun
# --
%macro ${1:FileAttribs}(filename);
  %local rc fid fidc Bytes CreateDT ModifyDT;

  %let rc=%sysfunc(filename(onefile, &filename));
  %let fid=%sysfunc(fopen(&onefile));
  %if &fid ne 0 %then %do;
    %let Bytes=%sysfunc(finfo(&fid,File Size (bytes)));
    %let CreateDT=%sysfunc(finfo(&fid,Create Time));
    %let ModifyDT=%sysfunc(finfo(&fid,Last Modified));
    %let fidc=%sysfunc(fclose(&fid));
    %let rc=%sysfunc(filename(onefile));
    %put NOTE: File size of &filename is &bytes bytes;
    %put NOTE- Created &createdt;
    %put NOTE- Last modified &modifydt;
    %end;
  %else %put &filename could not be open.;
%mend $1;

%$1("${2:path/to/file}")